package cn.cloud9.designpattern.dp05proxy.proxy_03_jdk_dynamic;

import cn.cloud9.designpattern.dp05proxy.proxy_01_static.Personal;
import cn.cloud9.designpattern.dp05proxy.proxy_01_static.Tenement;
import cn.cloud9.designpattern.dp05proxy.proxy_03_jdk_dynamic.proxy_pack.MyProxy;
import cn.cloud9.designpattern.dp05proxy.proxy_03_jdk_dynamic.proxy_pack.MyProxyHandler;
import sun.misc.ProxyGenerator;

import java.io.FileOutputStream;
import java.io.OutputStream;
import java.net.Proxy;

/**
 * @projectName: Java
 * @author: Cloud9
 * @date: 2022年05月23日 15:27
 * @version: 1.0
 */
public class JdkProxyTest {
    public static void main(String[] args) throws Exception {

        // 对接口生成代理实例，并写成一个字节码文件
        byte[] bytes = ProxyGenerator.generateProxyClass("$Proxy0", new Class[]{Tenement.class});
        OutputStream outputStream = new FileOutputStream("$Proxy0.class");
        outputStream.write(bytes);
        outputStream.flush();
        outputStream.close();

//        System.out.println(JdkProxyTest.class.getPackage().getName());




    }
}
